﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CalcMEF
{
    using CompositionHelper;

    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        /// <summary>
        /// </summary>
        CalciCompositionHelper objHelper = new CalciCompositionHelper();

        public MainWindow()
        {
            InitializeComponent();
        }

        private void btn_add_Click(object sender, RoutedEventArgs e)
        {
            this.DoAction("Add");
        }
        public void DoAction(string operType)
        {
            double num1 = double.Parse(txt_num1.Text);
            double num2 = double.Parse(txt_num2.Text);

            objHelper.AssembleCalculatorComponents();

            txt_kq.Text = objHelper.GetResult(num1, num2, operType).ToString();
            
        }

        private void btn_div_Click(object sender, RoutedEventArgs e)
        {
            this.DoAction("Divide");
        }

        private void btn_mul_Click(object sender, RoutedEventArgs e)
        {
            this.DoAction("Multiply");
        }
    }
}
